/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

package app.actions;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import org.apache.struts.action.Action;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;

/**
 *
 * @author Johann
 */
public class ComprarAction extends Action{

    @Override
    public ActionForward execute(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception {
        
        // Crear o recuperar la sesion del usuario
        HttpSession sesion = request.getSession();
        // Eliminamos la sesión
        sesion.removeAttribute("carrito");
        request.setAttribute("compraRealizada", "La compra se ha realizado correctamente.");
        
        return mapping.findForward("ok");
    }
    
    
}
